<%--
  Created by IntelliJ IDEA.
  User: sa手不太冷
  Date: 2022/9/11
  Time: 19:17
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<div>${user.username}欢迎光临</div>
<a href="/w9/addBrand.jsp">添加</a>
<table border="1" cellspacing="0" align="center">
    <tr>
        <th>序号</th>
        <th>品牌名称</th>
        <th>企业名称</th>
        <th>排序</th>
        <th>品牌介绍</th>
        <th>状态</th>
        <th>操作</th>
    </tr>
    <c:forEach items="${brands}" var="brand" varStatus="status" >
    <tr>
        <td>${status.count}</td>
       <td>${brand.brandName}</td>
       <td>${brand.companyName}</td>
       <td>${brand.ordered}</td>
       <td>${brand.description}</td>
        <td>
            <c:if test="${brand.status==0}">
                禁用
            </c:if>
            <c:if test="${brand.status==1}">
                启用
            </c:if>
        </td>
<%--        href="/w9/deleteBrand?id=${brand.id}"--%>
        <td><a href="/w9/selectById?id=${brand.id}">修改</a > <a href="javascript:deleteById(${brand.id},'${brand.brandName}')" >删除</a></td>
    </tr>
    </c:forEach>

</table>
<script>
    function deleteById(id,brandName){
        if(confirm("真的要删除"+brandName+"吗?")){
            location.href="/w9/deleteBrand?id="+id
        }
    }
</script>
</body>
</html>
